package com.mz.ozy.widget.dialog;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;

import com.mz.ozy.R;
import com.mz.ozy.utils.glideUtils.GlideUtils;

public class AiliPayCodeDialog extends BaseDialog implements View.OnClickListener {

    private final String alipayCollectionCode;
    private ImageView mIvAlipayCode;

    public AiliPayCodeDialog(Activity mContext, String alipayCollectionCode) {
        super(mContext, R.layout.dialog_alipay_code, Gravity.CENTER, true, true);
        this.alipayCollectionCode = alipayCollectionCode;
        initView();
    }

    private void initView() {
        setOnViewClick(R.id.iv_alipay_code, this);
        mIvAlipayCode = getView(R.id.iv_alipay_code);
        if (!TextUtils.isEmpty(alipayCollectionCode)) {
            GlideUtils.loadImg(mContext, mIvAlipayCode, alipayCollectionCode);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_alipay_code:
                if (mListener != null) {
                    mListener.onCancel();
                }
                break;
        }
    }

    private onDialogListener mListener;

    public void setOnDialogListener(onDialogListener listener) {
        mListener = listener;
    }

    public interface onDialogListener {
        void onCancel();
    }
}
